#include <iostream>
#include <cstring>
using namespace std;
const int BUFFER_SIZE = 32;
/*无参构造函数想要调用有参构造函数必须使用初始化列表*/
class Person
{
public:
#if 1
    Person()
    {
        cout << "父类无参构造\n";
    }
#endif
    ~Person()
    {
        cout << "父类析构函数\n";
    }
    Person(int age) : m_age(age)
    {
        cout << "父类带参构造\n";
    }
    void makeMoney()
    {
        cout << "person makemoney\n";
    }

private:
    int m_age;
};
class Student : public Person
{
public:
    Student()
    {
        cout << "Student子类无参构造\n";
    }
    Student(const char *name)
    {
        cout << "Student子类无参构造\n";
        m_name = new char[16];
        strncpy(m_name, name, strlen(name) + 1);
    }
    ~Student()
    {
        delete[] m_name;
        cout << "Student子类析构函数\n";
    }
    void makeMoney()
    {
        cout << "student makemoney\n";
    }

public:
    int m_no;
    char *m_name;
};

class Teacher : public Person
{
public:
    Teacher()
    {
        cout << "Teacher子类无参构造\n";
    }
    ~Teacher()
    {
        cout << "Teacher子类析构函数\n";
    }
    void makeMoney()
    {
        cout << "Teacher makemoney\n";
    }

public:
    int m_hair;
};

int main()
{
    Person *per = new Student("hello");
    per->makeMoney();
    delete per;

    return 0;
}